<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>微信公众号管理</title>
	<meta name="decorator" content="default"/>
</head>
<body>
	<div class="main-content">
        <tags:breadcrumb menuId="f13d0765fcfc42b783cb16d8b0ccc876" />
		<div class="page-content">
            <table id="contentTable" class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th>
                            公众号名称
                        </th>
                        <th>
                            Token
                        </th>
                        <th>
                            公众号账号
                        </th>
                        <th>
                            公众号类型
                        </th>
                        <th>
                            Email
                        </th>
                        <th>
                            公众号描述
                        </th>
                        <th>
                            公众号原始ID
                        </th>
                        <th>
                            添加时间
                        </th>
                        <th>
                            操作人
                        </th>
                        <shiro:hasPermission name="wechat:account:edit">
                            <th>
                                操作
                            </th>
                        </shiro:hasPermission>
                    </tr>
                </thead>
                <tbody>
            <c:forEach items="${page.list}" var="account">
                <tr>
                    <td><a href="${ctx}/weixinAccountService/form?id=${account.id}">${account.accountName}</a></td>
                    <td>${account.accountToken}</td>
                    <td title="${account.accountNumber}">${account.accountNumber}</td>
                    <td>${fns:getDictLabel(account.accountType, "Weixin_Type", "1")}</td>
                    <td>${account.accountEmail}</td>
                    <td>${account.accountDesc}</td>
                    <td>${account.weixinAccountId}</td>
                    <td><fmt:formatDate value="${account.createDate}" pattern="yyyy-MM-dd"/></td>
                    <td>${account.user.name}</td>
                    <shiro:hasPermission name="wechat:account:list"><td>
                        <a href="${ctx}/weixinAccountController/form?id=${account.id}">修改</a>
                        <a href="javascript:;" onclick="return deleteMsg('确认要删除该微信公众号吗？','${ctx}/weixinAccountController/delete?id=${account.id}',this)">删除</a>
                    </td></shiro:hasPermission>
                </tr>
            </c:forEach>
            </tbody>
        </table>
            <div class="pagination">${page}</div>
		</div>
	</div>
    <script type="text/javascript">
        $(document).ready(function() {

        });
        function page(n,s){
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }

        //删除
        function deleteMsg(msg,href,tr){
            layer.confirm(msg,{icon:5,title:"温馨提示"},function(index){
                loading();
                layer.close(index);
                $.post(href,function(data){
                    if(data.success){
                        showNote("success", function () {
                            $(tr).parent().parent().remove();
                        }, data.msg, "center");
                    }else {
                        showNote("error", function () {
                            return false;
                        }, data.msg);
                    }
                });
            });
        }
    </script>
</body>
</html>
